﻿using System;
using System.Text;

namespace ConfigGen.Core
{
    /// <summary>
    /// 
    /// </summary>
    public class OutputEncodingFactory
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="outputEncoding"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        public Encoding GetEncoding(string outputEncoding)
        {
            switch (outputEncoding)
            {
                case "A":
                    return Encoding.ASCII;

                case null:
                case "U8":
                    return Encoding.UTF8;

                case "U16":
                    return Encoding.Unicode;

                default:
                    throw new NotSupportedException("Specified encoding is not supported: " + outputEncoding);
            }
        }
    }
}